package com.alibaba.algo.apiimpl.user;

import com.alibaba.algo.cooperation.common.BaseResult;
import com.alibaba.algo.cooperation.usercomponent.service.user.SysSapLogService;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SysSapLogRequestVO;
import com.alibaba.algo.domain.user.SysSapLogDomain;
import com.alibaba.algo.entity.user.SysSapLog;
import com.alibaba.algo.util.DateConverterUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类SysSapLogServiceImpl.java的实现描述：sap操作日志
 *
 */
@Slf4j
@RestController
public class SysSapLogServiceImpl implements SysSapLogService {

    @Autowired
    private SysSapLogDomain sysSapLogDomain;

    @Override
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public BaseResult insert(SysSapLogRequestVO sysSapLogRequestVO) {
        SysSapLog sysSapLog = new SysSapLog();
        BeanUtils.copyProperties(sysSapLogRequestVO, sysSapLog);
        sysSapLog.setOptTime(DateConverterUtils.asLocalDateTime(sysSapLogRequestVO.getOptTime()));
        sysSapLogDomain.insert(sysSapLog);
        return BaseResult.buildSuccess();
    }

    @Override
    public BaseResult delete(SysSapLogRequestVO sysSapLogRequestVO) {
        return null;
    }

    @Override
    public BaseResult update(SysSapLogRequestVO sysSapLogRequestVO) {
        return null;
    }
}
